import { createApp } from "vue";
import App from "./App.vue";
import { setupCustomComponents } from "./plugins/customComponents";
import { setupDirectives } from "./plugins/directives";
import { setupNaive } from "./plugins/naive";
import router, { setupRouter } from './router'
import { setupStore } from "./store";

async function initApp() {
  const app = createApp(App);

  // 注册全局常用的 naive-ui 组件
  setupNaive(app);

  // 注册全局公共组件
  setupCustomComponents(app)

  // 注册全局自定义指令
  setupDirectives(app);

  // 挂载状态管理
  setupStore(app)

  // 挂载路由
  await setupRouter(app)

  // 路由准备就绪后挂载APP实例
  await router.isReady()

  app.mount("#app");
}
initApp()


